//**************************************//
//                                      //
//                                      //
//**************************************//
#include "vertex.h"
void DrawBuffer::Clear()
{
    vbuf.clear();
}
void DrawBuffer::VTex(mPoint P,unsigned int ID,float tx,float ty)
{
    union
    {
        unsigned int num;
        unsigned char ch[4];
    } data;
    data.num = ID;

    vertex ney;
    ney.x = P.x;
    ney.y = P.y;
    ney.z = P.z;
    ney.nx = 0;
    ney.ny = 0;
    ney.nz = 0;
    ney.r = 1;
    ney.g = 1;
    ney.b = 1;
    ney.a = 1;

    ney.id_r = (float)data.ch[2]/255.0f;
    ney.id_g = (float)data.ch[1]/255.0f;
    ney.id_b = (float)data.ch[0]/255.0f;

    ney.tx = tx;
    ney.ty = ty;

    vbuf.push_back(ney);
};



void DrawBuffer::Vert(mPoint P,float R,float G,float B,float A,mPoint normal,unsigned int ID,float tx,float ty)
{
    union
    {
        unsigned int num;
        unsigned char ch[4];
    } data;
    data.num = ID;

    vertex ney;
    ney.x = P.x;
    ney.y = P.y;
    ney.z = P.z;
    ney.nx = normal.x;
    ney.ny = normal.y;
    ney.nz = normal.z;
    ney.r = R;
    ney.g = G;
    ney.b = B;
    ney.a = A;

    ney.id_r = (float)data.ch[2]/255.0f;
    ney.id_g = (float)data.ch[1]/255.0f;
    ney.id_b = (float)data.ch[0]/255.0f;

    ney.tx = tx;
    ney.ty = ty;

    vbuf.push_back(ney);
};
